﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Register Src="~/Views/Shared/Textbox.ascx" TagName="textbox" TagPrefix="uc" %>
<%@ Register Src="~/Views/Shared/Button.ascx" TagName="button" TagPrefix="uc" %>

<div class="panel_left"></div>
<div class="panel_top"></div>
<div class="panel_topleft"></div>
<div class="panel_topright"></div>
<div class="panel_right"></div>
<div class="panel_bottomleft"></div>
<div class="panel_bottom"></div>
<div class="panel_bottomright"></div>
<%
    int lang = 2;
    VietImage.Models.Image img = (VietImage.Models.Image)ViewData["Image"];
    List<VietImage.Models.Lightbox> lst = (List<VietImage.Models.Lightbox>)ViewData["LightboxList"];
    if (img != null)
    {
%>
<style>
.addtolightboximginfo #imginfo
{
    float: left;
    margin-right: 30px;
    width: 200px;
}
.addtolightboximginfo #imginfo_img
{
    float: none;
}
.addtolightboximginfo #imginfo_img img
{
    width: 200px;
    height: 200px;
}
.addtolightboximginfo #imginfo_info 
{
    margin: 0px; width: 200px;
}
.addtolightboximginfo #imginfo_info .left
{
    width: auto;
}
</style>
<div class="addtolightboximginfo">
<div id="imginfo" imgid="<%= img.ID %>">
    <div id="imginfo_img">
        <img alt="<%= img.GetDetail(lang).Name %>" src="/Image/Display/<%= img.ID %>">
    </div>
    <div id="imginfo_info">
        <div id="imginfo_name">
            <div class="left">Tên ảnh</div>
            <div class="right"><%= img.GetDetail(lang).Name%></div>
            <div class="clear"></div>
        </div>
        <div id="imginfo_author">
            <div class="left">Tác giả</div>
            <div class="right"><%= img.Author%></div>
            <div class="clear"></div>
        </div>
        <div id="imginfo_date">
            <div class="left">Ngày đăng</div>
            <div class="right"><%= img.CreatedTime.ToString("d/M/yyyy")%></div>
            <div class="clear"></div>
        </div>
    </div>
</div>
<div style="float: left;" class="form">
    <div class="form_title">THÊM VÀO LIGHTBOX</div>
<%
        if (lst != null)
        {
%>
        <div class="left">
            Chọn Lightbox
        </div>
        <div id="cmbaddtolightbox" class="combobox" value="">
            <div class="combobox_selected"></div>
            <div class="combobox_button"></div>
            <div class="combobox_items">
<%
            foreach (VietImage.Models.Lightbox lb in lst)
            {
%>
                <div class="combobox_item" value="<%= lb.ID %>"><%= lb.Name%></div>
<% 
            }
%>
            </div>
        </div>
<%    
        }
%>
        <div class="clear"></div>
        <div class="left">Thêm vào Lightbox mới</div>
        <uc:textbox ID="txtaddtolightboxnewlightbox" runat="server" />
        <div class="clear"></div>
        <uc:button ID="btnaddtolightbox" Value="Thêm" runat="server" />
<script>
    $("#btnaddtolightbox").click(function (e) {
        var newlb = $("#txtaddtolightboxnewlightbox").val();
        var lb = $("#cmbaddtolightbox").attr("value");
        var img = $("#imginfo").attr("imgid");
        if (newlb.trim() != "") {
            ajaxquery("/Lightbox/AddToNewLightbox", { "name": newlb, "imgid": img }, function (data) {
                alert(data);
            });
        }
        else {
            ajaxquery("/Lightbox/AddToLightbox", { "id": lb, "imgid": img }, function (data) {
                alert(data);
            });
        }
    });
</script>
<%
    }    
%>

</div>
